package stream;

import java.io.Serializable;
import java.util.stream.Stream;

public class StreamConcat {
    public static void main(String[] args) {
        Stream<String> stream1 = Stream.of("孙悟空", "猪八戒", "撒曾");
        Stream<String> stream2 = Stream.of("孙悟空", "猪八戒", "撒曾");
        Stream<Integer> stream3 = Stream.of(11, 22, 33);
        Stream<String> concat = Stream.concat(stream1, stream2);
        concat.forEach(System.out::println);
        //合成一个流必须是同类型的流合并
        Stream.concat(stream1, stream3).forEach(System.out::println);
    }
}
